<template>
  <view class="SearchDiscussionList">
    <SearchDiscussionItem
      v-for="(item, index) in discussionList"
      :key="index"
      :discussionDetail="item"
    />
    <EmptyBox v-if="!discussionList.length" />
  </view>
</template>

<script>
import { mapState } from "vuex";
import SearchDiscussionItem from "../../../components/search/SearchDiscussionItem.vue";
import EmptyBox from "../../../components/public/EmptyBox.vue";
export default {
  name: "SearchDiscussionList",
  components: {
    SearchDiscussionItem,
    EmptyBox,
  },

  data() {
    return {
      discussionList: [],
    };
  },

  computed: {
    ...mapState("m_search", ["searchDiscussionList"]),
  },
  watch: {
    searchDiscussionList(newValue) {
      for (let i = 0; i < newValue.length; i++) {
        // 延迟动画效果
        setTimeout(() => {
          this.discussionList.push(newValue[i]);
        }, 100 * i);
      }
    },
  },
  methods: {},
};
</script>

<style lang="scss" scoped>
.SearchDiscussionList {
  background-color: #fff;
}
</style>
